package com.lsk.admin.shop;

import com.jfinal.plugin.activerecord.Db;
import org.apache.commons.collections.CollectionUtils;

import java.util.List;

/**
 * @author: lei.liu
 * @date 2021/3/6 17:05
 **/
public class CardService {

    public int batchUpdateCardStatus(List<String> cardIdList, Integer state) {
        if (CollectionUtils.isEmpty(cardIdList)) {
            return 0;
        }

        String sql = "update card set state = ? where id = ?";
        int row = 0;
        for (String cardId : cardIdList) {
            row += Db.update(sql, state, cardId);
        }
        return row;
    }
}
